#import "TAMTHomeItem.h"

#import "TAMeetApp-Swift.h"
#import "NSString+TAMTAttributed.h"

@interface TAMTHomeItem () {
    CGFloat _height;
    NSAttributedString *_attString;
}

@end

@implementation TAMTHomeItem


+ (NSDictionary *)modelCustomPropertyMapper {
    return @{
        @"avaCreatorRuby" : @"creator",
        @"samDescElliot" : @"desc",
        @"liamEnableWelcomeHazel" : @"enableWelcome",
        @"zoeGroupFrameIdHazel" : @"groupFrameId",
        @"noahHasUpScarlett" : @"hasUp",
        @"lucyIdFieldScarlett" : @"idField",
        @"ellaImgAlice" : @"img",
        @"leoImgFrameUrlAria" : @"imgFrameUrl",
        @"alexLevelHazel" : @"level",
        @"tomMaxMembersBella" : @"max_members",
        @"leoMemberAvatarsMason" : @"member_avatars",
        @"maxMembersBella" : @"members",
        @"benModeLogan" : @"mode",
        @"liamNameAlice" : @"name",
        @"chloeOnlineCountAlice" : @"onlineCount",
        @"avaOwnerNameHarper" : @"owner_name",
        @"oliviaRoomIdDylan" : @"roomId",
        @"zoeUpNumJordan" : @"upNum",
        @"liamWelcomeHarper" : @"welcome"
    };
};

- (CGFloat)height {
    if (!_height) {
        
        _attString = [self.samDescElliot attributedStringWithlineSpacing:5 textColor:[UIColor colorWithRed:102.0/255.0 green:102.0/255.0 blue:102.0/255.0 alpha:1] font:[UIFont systemFontOfSize:14 weight:UIFontWeightRegular]];
     
        CGFloat textHeight = [_attString heightWithWidth:UIScreen.mainScreen.bounds.size.width - 48 - 12 font:[UIFont systemFontOfSize:14 weight:UIFontWeightRegular]];
        
        _height = 70 + 12 + textHeight + 12 + 28 + 16;
    }
    return _height;
}

@end
